package org.geom.curve.helix;

import org.geom.Maths;
import org.geom.Point3D;
import org.geom.Vector3D;
import org.geom.curve.Curve;

public class Elicoide extends Curve{

	public static final String R = "r";
	public static final String K = "k";

	public static float arc = 0.8f; //
	
	//---------------------------------------------------------------------- constructor
	public Elicoide() {
		super();
	}
	
	//---------------------------------------------------------------------- publics +
	public float r = 40;
	public float k = 30;

	//------------------------------------------------ abstract implementation
	public Point3D sample(float t) {
		Point3D p = new Point3D();
		
		p.x = r * Maths.cos(t);
		p.y = r * Maths.sin(t);
		p.z = k * t;
		
		return p;		
	}
		
	@Override
	protected Vector3D derivateI(float t)  {
		Vector3D p = new Vector3D();
		
		p.x = r * Maths.sin(t);
		p.y = r * -Maths.cos(t);
		p.z = k;
		
		return p;
	}
	
	@Override
	protected Vector3D derivateII(float t) {  
		Vector3D p = new Vector3D();
		
		p.x = r * -Maths.cos(t);
		p.y = r * -Maths.sin(t);
		p.z = 0;
		
		return p;
	}

	@Override
	public float getArc() {
		/*TODO
		 * ogni curva è parametrizzata sull'arco di curva. qui specificare 
		 * la lunghezza dell'arco*/
		//return 0.8f;
		float totallength = Maths.TWO_PI*5;
		return totallength/((float)length-1);
	}

}
